package com.yc.cinema.biz;

import com.yc.cinema.bean.User;
import com.yc.cinema.dao.HallDao;
import com.yc.cinema.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userBiz")
public class UserBiz {

	private String name;
	private int age;

	public UserBiz(){}

	public UserBiz(int age) {
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void init(){
		System.out.println("========= userBiz.init ===========");
	}

	public void destroy(){
		System.out.println("========= userBiz.destroy ===========");
	}

	@Autowired  // spring 提供 默认byType
	@Qualifier("userDao")  // Qualifier限定词注解
	private UserDao udao;
	@Resource
	public UserDao userDao;
	//@Resource
	public UserDao myUserDao;
	//@Resource
	public UserDao myDao;

	@Resource   // java 提供,  默认byName
	private HallDao hallDao;

	public User login(String name, String pwd) {
		return null;
	}

	public void register(User user) throws BizException {

	}

	public UserDao getUdao() {
		return udao;
	}

	public void setUdao(UserDao udao) {
		this.udao = udao;
	}

	public HallDao getHallDao() {
		return hallDao;
	}

	public void setHallDao(HallDao hallDao) {
		this.hallDao = hallDao;
	}
}
